package com.xiaoma.base;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.InitializingBean;

public class MyFactoryBean implements FactoryBean<ManImpl>,InitializingBean {


  private static final Logger logger = LoggerFactory.getLogger(MyFactoryBean.class);

  private  Class<?>[]  interfaceName;
  private Object target;
  private Object proxyObj;



  public Class<?>[] getInterfaceName() {
    return interfaceName;
  }

  public void setInterfaceName(Class<?>[] interfaceName) {
    this.interfaceName = interfaceName;
  }

  public Object getTarget() {
    return target;
  }

  public void setTarget(Object target) {
    this.target = target;
  }

  public Object getProxyObj() {
    return proxyObj;
  }

  public void setProxyObj(Object proxyObj) {
    this.proxyObj = proxyObj;
  }


  @Override
  public ManImpl getObject() throws Exception {
    return new ManImpl();
  }

  @Override
  public Class<?> getObjectType() {
    return ManImpl.class;
  }

  @Override
  public boolean isSingleton() {
    return false;
  }

  @Override
  public void afterPropertiesSet() throws Exception {
    System.out.println("afterPropertiesSet///////////////");

/*    this.proxyObj=Proxy.newProxyInstance(
        this.getClass().getClassLoader(),
        this.interfaceName ,
        new InvocationHandler() {
          @Override
          public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
            Object result = method.invoke(target, args);
            return result;

          }
        });*/

  }

}
